package com.bootdo.acitvity.DDD.domain.event;

import com.bootdo.acitvity.DDD.domain.CenterBatch;
import com.bootdo.acitvity.DDD.domain.entity.Stock;
import lombok.experimental.Accessors;

public class StockUpdateContext {

    @Accessors
    private StockUpdateStrategy stockUpdateStrategy;

    public StockUpdateContext(StockUpdateStrategy stockUpdateStrategy) {
        this.stockUpdateStrategy = stockUpdateStrategy;
    }

    public static StockUpdateContext withStrategy(StockUpdateStrategy stockUpdateStrategy){
        return new StockUpdateContext(stockUpdateStrategy);
    }

    public void updateStock(CenterBatch batch, Stock stockChange) {
        stockUpdateStrategy.updateStock(batch, stockChange);
    }

}
